/*
 * KMeansMetadata.java
 *
 * Created on December 5, 2007, 8:42 AM
 */

package kmeans;

import javax.swing.JTextField;

/**
 *
 * @author  Administrator
 */
public class KMeansMetadata extends javax.swing.JDialog {
    
    /** Creates new form KMeansMetadata */
    public KMeansMetadata(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jInternalFrame1 = new javax.swing.JInternalFrame();
        jLabel1 = new javax.swing.JLabel();
        jtfNumberOfClusters = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jtfLocationDataSet = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jtfLocationMatlabFiles = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jtfMinError = new javax.swing.JTextField();
        jbtRunKmeans = new javax.swing.JButton();
        jbtCancel = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jtfColumnsToUse = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setAlwaysOnTop(true);
        setLocationByPlatform(true);

        jInternalFrame1.setVisible(true);

        jLabel1.setText("Number of Clusters");

        jtfNumberOfClusters.setColumns(3);
        jtfNumberOfClusters.setText("3");

        jLabel2.setText("Location of Data set");

        jtfLocationDataSet.setText("C:\\economyrankings.dat");

        jLabel3.setText("Location for matlab files");

        jtfLocationMatlabFiles.setText("C:\\");

            jLabel4.setText("Minimal Error");

            jtfMinError.setColumns(3);
            jtfMinError.setText("1.0");

            jbtRunKmeans.setText("Run Kmeans");
            jbtRunKmeans.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mousePressed(java.awt.event.MouseEvent evt) {
                    jbtRunKmeansMousePressed(evt);
                }
            });
            jbtRunKmeans.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    jbtRunKmeansKeyPressed(evt);
                }
            });

            jbtCancel.setText("Cancel");
            jbtCancel.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jbtCancelMouseClicked(evt);
                }
            });
            jbtCancel.addComponentListener(new java.awt.event.ComponentAdapter() {
                public void componentResized(java.awt.event.ComponentEvent evt) {
                    jbtCancelComponentResized(evt);
                }
            });
            jbtCancel.addContainerListener(new java.awt.event.ContainerAdapter() {
                public void componentRemoved(java.awt.event.ContainerEvent evt) {
                    jbtCancelComponentRemoved(evt);
                }
            });

            jLabel5.setText("Colums to use");

            jtfColumnsToUse.setColumns(3);
            jtfColumnsToUse.setText("1,8");

            javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
            jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
            jInternalFrame1Layout.setHorizontalGroup(
                jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jInternalFrame1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtfLocationDataSet, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jInternalFrame1Layout.createSequentialGroup()
                                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jbtRunKmeans)
                                    .addComponent(jLabel3))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jtfLocationMatlabFiles)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
                                        .addComponent(jbtCancel)
                                        .addGap(31, 31, 31)))))
                        .addGroup(jInternalFrame1Layout.createSequentialGroup()
                            .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel1)
                                .addComponent(jLabel4)
                                .addComponent(jLabel5))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jtfColumnsToUse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jtfMinError, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jtfNumberOfClusters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            jInternalFrame1Layout.setVerticalGroup(
                jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jInternalFrame1Layout.createSequentialGroup()
                    .addGap(31, 31, 31)
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(jtfNumberOfClusters, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(jtfMinError, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(jtfColumnsToUse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jtfLocationDataSet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jtfLocationMatlabFiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jbtRunKmeans)
                        .addComponent(jbtCancel))
                    .addContainerGap())
            );

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jInternalFrame1)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            );

            pack();
        }// </editor-fold>//GEN-END:initComponents

    public JTextField getJtfColumnsToUse() {
        return jtfColumnsToUse;
    }

    public void setJtfColumnsToUse(JTextField jtfColumnsToUse) {
        this.jtfColumnsToUse = jtfColumnsToUse;
    }

    public JTextField getJtfLocationDataSet() {
        return jtfLocationDataSet;
    }

    public void setJtfLocationDataSet(JTextField jtfLocationDataSet) {
        this.jtfLocationDataSet = jtfLocationDataSet;
    }

    public JTextField getJtfLocationMatlabFiles() {
        return jtfLocationMatlabFiles;
    }

    public void setJtfLocationMatlabFiles(JTextField jtfLocationMatlabFiles) {
        this.jtfLocationMatlabFiles = jtfLocationMatlabFiles;
    }

    public JTextField getJtfMinError() {
        return jtfMinError;
    }

    public void setJtfMinError(JTextField jtfMinError) {
        this.jtfMinError = jtfMinError;
    }

    public JTextField getJtfNumberOfClusters() {
        return jtfNumberOfClusters;
    }

    public void setJtfNumberOfClusters(JTextField jtfNumberOfClusters) {
        this.jtfNumberOfClusters = jtfNumberOfClusters;
    }

    private void jbtRunKmeansKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbtRunKmeansKeyPressed
        this.setVisible(false);
    }//GEN-LAST:event_jbtRunKmeansKeyPressed

    private void jbtCancelComponentRemoved(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_jbtCancelComponentRemoved
        // TODO add your handling code here:
    }//GEN-LAST:event_jbtCancelComponentRemoved

    private void jbtCancelComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jbtCancelComponentResized
        // TODO add your handling code here:
    }//GEN-LAST:event_jbtCancelComponentResized

    private void jbtCancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtCancelMouseClicked
        System.exit(0);
    }//GEN-LAST:event_jbtCancelMouseClicked

    private void jbtRunKmeansMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbtRunKmeansMousePressed
        this.setVisible(false);
    }//GEN-LAST:event_jbtRunKmeansMousePressed
    
    public boolean isHidden(){
        return this.isVisible();
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                KMeansMetadata dialog = new KMeansMetadata(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JButton jbtCancel;
    private javax.swing.JButton jbtRunKmeans;
    private javax.swing.JTextField jtfColumnsToUse;
    private javax.swing.JTextField jtfLocationDataSet;
    private javax.swing.JTextField jtfLocationMatlabFiles;
    private javax.swing.JTextField jtfMinError;
    private javax.swing.JTextField jtfNumberOfClusters;
    // End of variables declaration//GEN-END:variables
    
}
